<section class="section {page->class}">
	<h2 class="hide">{page->title}</h2>
	<script>
		$(function() {
			{? script}
				{@ script}
			$.getScript('{CFG->PATH->JS}/{.value_}');
				{/}
			{/}
			
			
			// 반드시 셋타임 아웃을 해줘야됨.
			setTimeout(function(){
				$("#member_add").validate({
					rules: {
						 mem_id : {required:true, userid:true}
						,mem_pwd : {required:true, password:true}
						,mem_pwd_confirm : {required:true, password:true, equalTo:"#mem_pwd"}
						,mem_name : "required"
						,mem_email : {required:true, email:true}
					},
					submitHandler : function(form) {
						// ajax로 등록후 list 페이지 새로 고침
						$.ajax({
							 url : form.action
							,data : $(form).serialize()
							,success:function(data){
								if(data.code == mesg.success) {
									sagapo.section_refresh(data.return_url);
								} else {
									alert(data.msg);
								}
								
								return false;
							}
						});
					}
				});
				
				
				$("#mem_id_overlap").click(function() {
					mid = $("#mem_id");
					
					if(mid.valid()) {
						url = "{CFG->PATH->WWW}/member/getMID/"+mid.val();
						$.ajax({url:url, success:function(data){
							if(mesg.success == data.code) {
								if(confirm(data.msg)) {
									$("#mem_id2").val(mid.val());
								} else {
									mid.val("").focus();	
								}
							} else {
								alert(data.msg);
								mid.val("").focus();
							}
						}});
					} else {
						mid.focus();
					}
					return false;
				});
				
				$('textarea.wysiwyg').tinymce($.extend(aktimemce));
				
				// 포커스가 wysiwyg 쪽으로 이동하기 때문에 젤 처럼 element로 포커스 다시 이동시키기
				$("#mem_id").focus();
			},300);
		});
	</script>
	<form name="member_add" id="member_add" action="{CFG->PATH->WWWADMIN}/member/doAdd" method="post">
		<table class="table">
			<caption>
				{page->title}
			</caption>
			<colgroup>
				<col class="add" />
				<col />
			</colgroup>
			<tbody>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_id">아이디</label></th>
					<td>
						<input type="text" name="mem_id" id="mem_id" placeholder="아이디" class="width_30" />
						<input type="hidden" name="mem_id2" id="mem_id2" placeholder="아이디 중복확인 체크" class="required" />
						<button type="button" class="accept" id="mem_id_overlap">중복확인</button>
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_pwd">비밀번호</label></th>
					<td>
						<input type="password" name="mem_pwd" id="mem_pwd" placeholder="비밀번호" class="width_50" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_pwd_confirm">비밀번호 확인</label></th>
					<td>
						<input type="password" name="mem_pwd_confirm" id="mem_pwd_confirm" placeholder="비밀번호 확인" class="width_50" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_name">이름</label></th>
					<td>
						<input type="text" name="mem_name" id="mem_name" placeholder="이름" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_email">이메일</label></th>
					<td>
						<input type="email" name="mem_email" id="mem_email" placeholder="email" class="width_60" />
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_sendemail_0">이메일 수신</label></th>
					<td>
						<input type="radio" name="mem_sendemail" id="mem_sendemail_0" value="1" checked="checked" /><label for="mem_sendemail_0"> 수신</label>
						<input type="radio" name="mem_sendemail" id="mem_sendemail_1" value="0" /><label for="mem_sendemail_1"> 미수신</label>
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_auth_0">인증</label></th>
					<td>
						<input type="radio" name="mem_auth" id="mem_auth_0" value="1" checked="checked" /><label for="mem_auth_0"> 인증</label>
						<input type="radio" name="mem_auth" id="mem_auth_1" value="0" /><label for="mem_auth_1"> 미인증</label>
					</td>
				</tr>
				<tr>
					<th scope="row" class="txt_right br"><label for="mem_sign">서명</label></th>
					<td>
						<textarea name="mem_sign" id="mem_sign" class="width_90 wysiwyg" placeholder="서명"></textarea>
					</td>
				</tr>
				<!-- 
				<tr>
					<th scope="row" class="txt_right br">사진</th>
					<td>
						&nbsp; 사진은 나중에
					</td>
				</tr>
				 -->
			</tbody>
		</table>
		
		<div class="button_area">
			<button type="submit">전송</button>
		</div>
	</form>
</section>